/**
 * Created by loso on 2017/3/27.
 */
public class _278_FirstBadVersion {

    public int firstBadVersion(int n) {
        int left = 0;
        int right = n;

        while(left<right){
            int mid = left + (right - left)/2;
            if (isBadVersion(mid)){
                right = mid -1;
            }
            else {
                left = mid +1;
            }
        }
        if (!isBadVersion(right)){
            return right +1;
        }
        return right;
    }

    public boolean isBadVersion(int n ){
        return false;
    }

}
